﻿Imports System.Data.OleDb

Public Class addNewRestaurant
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnsave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsave.Click
        Dim sql As String = "INSERT INTO restaurants (RName,RAddress,RWebsite,RPicture,AveragePriceInPounds,Tel) VALUES (@f1,@f2,@f3,@f4,@f5,@f6)"

        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("RestaurantConnectionString").ConnectionString)

        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)

        cmd.Parameters.AddWithValue("@f1", txtrestname.Text)
        cmd.Parameters.AddWithValue("@f2", txtaddress.Text)
        cmd.Parameters.AddWithValue("@f3", txtwebsite.Text)
        cmd.Parameters.AddWithValue("@f4", txtpicture.Text)
        cmd.Parameters.AddWithValue("@f5", txtaverageprice.Text)
        cmd.Parameters.AddWithValue("@f6", txttel.Text)

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("RestaurantList.aspx")






    End Sub
End Class